var dbConfig = require("../db_connection/dbConfig");
var connection = dbConfig.getConnection();

var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res) {
	
	var itemid = req.param("itemid");
	var username = req.param("username");
	var payfor = req.param("buybid");
	var orderid = req.param("orderid");
	var status = 0;
	var amount = 1000;
	var company_user_id = req.param("company_user_id");
	var archived = 0;
	var company_key = req.param("company");
	var branch_id = req.param("branch_id");
	
	var query = connection.query("INSERT INTO payment (bid_pack_id, username, type, reference, status, price, date_modified, modified_by, added_by, archived, company, settings_id, branch_id) " +
	"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" , [itemid, username, payfor, orderid, status, amount, new Date(), company_user_id, company_user_id, archived, company_key, 1, branch_id] ,  function(err, rows) {
		if (err) {
			console.log("Error Selecting : %s ", err);
		} else {
			console.log("Test");
		}
		
	});
	
});

module.exports = router;